﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace System
{
    public static class Extensions
    {
        public static string[] ToUrlArray(this Dictionary<string, string> dict)
        {
            int _counter = 0;
            var _array = new string[dict.Count];

            Dictionary<string, string>.Enumerator e = dict.GetEnumerator();
            while (e.MoveNext())
                _array[_counter++] = string.Format("{0}={1}", e.Current.Key, e.Current.Value);

            return _array;
        }

        public static void RemoveBackEntries(this NavigationService navi)
        {
            while (navi.BackStack.FirstOrDefault() != null)
            {
                navi.RemoveBackEntry();
            }
        }
    }
}
